import { defineStore } from 'pinia'
import { getStationList } from '@/api/station'

// state  计算属性(getters)  同步修改数据   处理异步actions
const useStore = defineStore({
    id: "car",
    state(){
        return {
            stationList: []
        }
    },
    actions: {
        async init() {
            const { data } = await getStationList()
            this.stationList = data.data
        },
        addStationList(list) {
            this.stationList = this.stationList.concat(list)
        }
    }
})

export {
    useStore
}